package com.lan.mall.common.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;
    private String massage;
    private Object data;

    public static R success(){
        return new R(REnum.SUCCESS.getCode(), REnum.SUCCESS.getMassage(), null);
    }

    public static R success(Object data){
        return new R(REnum.SUCCESS.getCode(), REnum.SUCCESS.getMassage(), data);
    }

    public static R error(){
        return new R(REnum.ERROR.getCode(), REnum.ERROR.getMassage(), null);
    }

    public static R error(Object data){
        return new R(REnum.ERROR.getCode(), REnum.ERROR.getMassage(), data);
    }

    public static R timeOut(){
        return new R(REnum.TIME_OUT.getCode(), REnum.TIME_OUT.getMassage(), null);
    }
}
